<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:o="http://openfaces.org/"
	template="/WEB-INF/esquema/plantillaworkflow.xhtml">

	<!--
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/esquema/sidebar2.xhtml"/>
	</ui:define>
	-->
	<ui:define name="mainControls">
		<o:commandButton value="#{messages['button.ok']}" onclick="finish();" />
		<o:commandButton value="#{messages['button.l8r']}" onclick="pause();" />
	</ui:define>

	<ui:define name="extraControls">
	</ui:define>
	
	<ui:define name="body">
		<div align="center">
			<br/>
			<strong>#{messages['analysis.header']}</strong>
			<rich:separator lineType="solid"/>
			<br/>

			<ui:include src="/WEB-INF/includes/showHelpIncl.xhtml">
				<ui:param name="width" value="500" />
				
				<ui:param name="msgBullet"  value="#{messages['analysis.bullet1']}" />
				<ui:param name="msgBullet1" value="#{messages['analysis.bullet2']}" />
			</ui:include>

			<br/>
		</div>
		<h:form>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.type']}</strong>
				<rich:separator lineType="solid"/>
				<h:panelGrid columns="2">
					<h:outputText value="#{messages['analysis.request_type']}" />
					<h:selectOneMenu value="#{transactionHelper.requestType}">
						<f:selectItems value="#{transactionHelper.requestTypes}"/>
						<a4j:support event="onkeyup" reRender="subType"/>
						<a4j:support event="onchange" reRender="subType"/>
					</h:selectOneMenu>
					
					<h:outputText value="#{messages['analysis.request_subtype']}" />
					<h:selectOneMenu id="subType" value="#{transactionHelper.requestSubType}">
						<f:selectItems value="#{transactionHelper.requestSubTypes}"/>
					</h:selectOneMenu>
				</h:panelGrid>
			</div>
			<br/>
			<br/>
			<div align="center">
				<strong>#{messages['analysis.property_list']}</strong>
				<rich:separator lineType="solid"/>
				<br />
				<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectZonePanel')}.show()">
					<h:outputText value="#{messages['permit.select_zone']}"/>
				</a4j:commandLink>
				<br />
				<br />
				<br />
				<h:panelGroup id="grpZone">
					<ui:repeat value="#{transactionHelper.requestedZoneList}" var="zone">
					<rich:panel>
						<table width="90%">
							<tr>
								<td>
									<rich:panel>
									<ui:include src="/WEB-INF/includes/zoneInfoIncl.xhtml">
										<ui:param name="zone" value="#{zone}" />
										<ui:param name="noZoneMsg" value="#{messages['permit.no_zone_selected']}" />
										<ui:param name="width" value="50%" />
									</ui:include>
									</rich:panel>
								</td>
								<td valign="top">
									<rich:panel>
									<a4j:commandButton
										value="#{messages['button.delete']}"
										action="#{transactionHelper.excludeSelectedZone(zone)}"
										reRender="grpZone"
										immediate="true">
									</a4j:commandButton>
									</rich:panel>
								</td>
							</tr>
						</table>
					</rich:panel>
					</ui:repeat>
				</h:panelGroup>
			</div>

			<br/>
			<br/>
			
			<div align="center">
				<br/>
				<strong>#{messages['analysis.dictum']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:inputTextarea value="#{transactionHelper.transaction.analysisDictum}" rows="5" style="width:75%">
				</h:inputTextarea>
			</div>
				
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.additional_observations']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:inputTextarea value="#{transactionHelper.transaction.additionalObservations}" rows="5" style="width:75%">
				</h:inputTextarea>
			</div>
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.request_dictum']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:selectOneRadio value="#{transactionHelper.requestToProceed}">
					<f:selectItem itemLabel="#{messages['analysis.request_proceeds']}" itemValue="true"/>
					<f:selectItem itemLabel="#{messages['analysis.request_notproceeds']}" itemValue="false"/>
				</h:selectOneRadio>
			</div>
			<br/>
			<br/>
			<br/>
			<div align="center">
				<a4j:jsFunction name="finish" action="#{transactionHelper.endAnalysis}" />
				#{'  '}
				<a4j:region>
					<a4j:jsFunction name="pause" action="home" />
				</a4j:region>
			</div>
		</h:form>
		
		<ui:include src="/zoneselector/selectZonePanel.xhtml">
			<ui:param name="width" value="800" />
			<ui:param name="height" value="620" />
			<ui:param name="drawParcelLayerOnly" value="true" />
			<ui:param name="selectAction" value="transactionHelper.selectZonesFromMap" />
			<ui:param name="render" value="grpZone" />
		</ui:include>
	</ui:define>
	
</ui:composition>
